<?php
namespace app\index\controller;
use think\Db;

class Website extends Base
{
    public function index(){
        $doclist = Db::name('website')->where('isshow','<',1)->order('id desc')->paginate(17);
        return $this->fetchHtml('index' , [
            'web_title'=> "看球吧体育专题|足球直播|NBA直播|JRS直播-看球吧",
            'web_kw'   => "看球吧体育专题,足球直播,NBA直播,JRS直播,360直播,NBA录像回放,看球吧",
            'web_desc' => "看球吧体育专题是一个专注于足球直播、NBA直播、JRS直播、360直播、NBA录像、NBA录像回放的网站，看球吧一直用心分享体育内容。",
            'doclist' => $doclist
        ]);
    }

    public function info($id = 0){
        $id = intval($id);
        if($id <= 0){
            $this->redirect('index');
            exit;
        }
        $info = db('website' , [] , false)->where('id' , $id)->find();
        db('website' , [] , false)->where('id' , $id)->setInc('view');
        $pre = db('website' , [] , false)->where('id' ,'<', $info['id'])->order('id desc')->find();
        $next = db('website' , [] , false)->where('id' ,'>', $info['id'])->order('id desc')->find();
        $hotlist = db('website' , [] , false)->order('view desc')->limit(12)->select();
        return $this->fetchHtml('info',[
            'web_title' =>   $info['web_title']. '-看球吧',
            'web_kw' => $info['keywords'],
            'web_desc' => $info['desc'],
            'info' => $info,
            'pre' => $pre,
            'next' => $next,
            'hotlist' => $hotlist
        ]);
    }
}